.class public Lorg/microemu/log/QueueAppender;
.super Ljava/lang/Object;
.source "QueueAppender.java"

# interfaces
.implements Lorg/microemu/log/LoggerAppender;


# instance fields
.field private buferSize:I

.field private queue:Ljava/util/List;


# direct methods
.method public constructor <init>(I)V
    .locals 1
    .parameter "buferSize"

    .prologue
    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 36
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Lorg/microemu/log/QueueAppender;->queue:Ljava/util/List;

    .line 39
    iput p1, p0, Lorg/microemu/log/QueueAppender;->buferSize:I

    .line 40
    return-void
.end method


# virtual methods
.method public append(Lorg/microemu/log/LoggingEvent;)V
    .locals 2
    .parameter "event"

    .prologue
    .line 43
    iget-object v0, p0, Lorg/microemu/log/QueueAppender;->queue:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 44
    iget-object v0, p0, Lorg/microemu/log/QueueAppender;->queue:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    iget v1, p0, Lorg/microemu/log/QueueAppender;->buferSize:I

    if-le v0, v1, :cond_0

    .line 45
    iget-object v0, p0, Lorg/microemu/log/QueueAppender;->queue:Ljava/util/List;

    const/4 v1, 0x0

    invoke-interface {v0, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    .line 47
    :cond_0
    return-void
.end method

.method public poll()Lorg/microemu/log/LoggingEvent;
    .locals 2

    .prologue
    .line 50
    iget-object v0, p0, Lorg/microemu/log/QueueAppender;->queue:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-nez v0, :cond_0

    .line 51
    const/4 v0, 0x0

    .line 53
    .end local p0
    :goto_0
    return-object v0

    .restart local p0
    :cond_0
    iget-object v0, p0, Lorg/microemu/log/QueueAppender;->queue:Ljava/util/List;

    const/4 v1, 0x0

    invoke-interface {v0, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    move-result-object p0

    .end local p0
    check-cast p0, Lorg/microemu/log/LoggingEvent;

    move-object v0, p0

    goto :goto_0
.end method
